This example selects all the text in a RichTextBox control, then sets both the left and right indents to create margins. To try this example, put a RichTextBox control, a CommandButton control, and a TextBox control on a form. Load a file into the RichTextBox, and paste this code into the General Declarations section of the form. Then run the example.
Private Sub Command1_Click()
Dim Margins As Integer
Margins = CInt(Text1.Text)
With RichTextBox1
.SelStart = 1
.SelLength = Len(RichTextBox1.Text)
.SelIndent = Margins
.SelRightIndent = Margins
End With
End Sub